package com.example.spring_aop.proxy;

/**
 * Created with IntelliJ IDEA.
 * Description: 代理
 * User: Li_yizYa
 * Date: 2025/7/24
 * Time: 17:20
 */
public class HouseProxy implements HouseSubject{
    // 代理没有房子，要想租房，需要先 new 一个房东对象
    private RealHouseSubject subject;

    public HouseProxy(RealHouseSubject subject) {
        this.subject = subject;
    }

    @Override
    public void rent() {
        System.out.println("我是中介，我帮房东开始代理");
        subject.rent();
        System.out.println("我是中介，我帮房东结束代理");
    }

    @Override
    public void sale() {
        System.out.println("我是中介，我帮房东开始代理");
        subject.sale();
        System.out.println("我是中介，我帮房东结束代理");
    }
}
